clear all;

f1986=[730	161	90	67	52	47	51	44	32	31	29	16	18	16	8	7];
f2007=[740	169	95	72	55	50	53	45	25	21	22	12	15	12	4	5];
f2019=[764	205	114	104	86	62	27	31	10	11	4	2	4	4	0	0];
dist86_hist=[3.08437500000000	9.25312500000000	15.4218750000000	21.5906250000000	27.7593750000000	33.9281250000000	40.0968750000000	46.2656250000000	52.4343750000000	58.6031250000000	64.7718750000000	70.9406250000000	77.1093750000000	83.2781250000000	89.4468750000000	95.6156250000000];

%% plot

y1986=f1986/sum(f1986);
y2007=f2007/sum(f2007);
y2019=f2019/sum(f2019);

fig=figure('color', [1 1 1 ], 'Position',[200 20 800 320]);

hold on
y=[y1986',y2007',y2019'];
bar(dist86_hist-2.15,y(:,1),0.3,'Facecolor',[0,0,1])
bar(dist86_hist-0.3,y(:,2),0.3,'Facecolor',[0,1,1])
bar(dist86_hist+1.55,y(:,3),0.3,'Facecolor',[1 0 1])
box on

xlabel('distance from the nearest bank branch in 1986 (min)', 'FontSize',12,'Interpreter','Latex');
ylabel('probability density', 'FontSize',12,'Interpreter','Latex');
legend('road network in early 1980s','road network in 2007','road network in 2019','Interpreter','Latex','location','northeast');

set(gca,'FontSize',12);